﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using BookSystem.CommomHelper;
using BookSystem.Model;

namespace BookSystem.BLL
{
    class Book
    {
        //
        public static model.Book getBook(String Bid)
        {

            model.Book b = new model.Book();
            String strSql = "select * from T_books where Bid = @Bid";

            DataTable dt = SQLHelper.ExecuteTable(strSql, new SqlParameter("@Bid", Bid));

            if (dt.Rows.Count <= 0)
            {
                return b;

            }
            else
            {

                b.Bid = dt.Rows[0][0].ToString().Trim();
                b.Bname = dt.Rows[0][1].ToString().Trim();
                b.Bpress = dt.Rows[0][2].ToString().Trim();
                b.Author = dt.Rows[0][3].ToString().Trim();

                return b;

            }

        }
    }
}
